/*
 * etch-a-sketch.h
 *
 *  Created on: Nov 26, 2012
 *      Author: bradyce
 */

#ifndef ETCH_A_SKETCH_H_
#define ETCH_A_SKETCH_H_


#include "msp430x22x4.h"
#include <stdlib.h>
#include "RBX430-1.h"
#include "RBX430_lcd.h"
void getCoordinates(uint16 *L_pot, uint16 *R_pot);
void draw(uint16 *x_prev, uint16 *y_prev);
void initBoard(void);
unsigned int lowpass_filter_init(unsigned int input);
unsigned int lowpass_filter(unsigned int input, unsigned int* delay);
void line(int x1, int y1, int x2, int y2);
unsigned int getNumChars(uint16 num);

#define myCLOCK	8000000					// clock speed
#define WDT_CLK	32000					// 32 Khz WD clock (@1 Mhz)
#define	WDT_CTL	WDT_MDLY_32				// WDT SMCLK, ~32ms
#define	WDT_CPS	myCLOCK/WDT_CLK			// WD clocks / second count
#define NUM_SAMPLES 16
#define NUM_BSHIFT 4
#define THRESHOLD 2
#define FILTER_SHIFT 3
#define COUNTER 8
#define SCALE(x) ((float)x / (float)1023)*159

#endif /* ETCH_A_SKETCH_H_ */
